<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/hpp_c1_c2.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<%@ include file="/common/meta.jsp" %>
<title>VTC - Holistic Programme Planning - HPP</title>
<%@ include file="/common/css_js.jsp"%>

<script type="text/javascript">
	$(function(){
		var hasStream="<s:property value='hasStream'/>";
		if(hasStream=="true"){
			$("#addGroupBtn").attr("disabled",true);//1
			$("#deleteGroupBtn").attr("disabled",true);//1
		}		
	});

	
	function clickBtn(action,e,id){
		var code="<s:property value='code'/>";
		var programmeId="<s:property value='programmeId'/>";
		
		switch(action){
		case "add":
			popup(e, "programme-subject-group!input.action?no-decorate&programmeId="+programmeId+"&code="+code, 'width:800;height:600');
			return;
			
		case "delete":
			$("#mainForm").attr("action","programme-subject-group!delete.action");
			$("#mainForm").submit();
			return;
			
		case "edit":
			popup(e, "programme-subject-group!input.action?no-decorate&programmeId="+programmeId+"&code="+code+"&subjectGroup.id="+id, 'width:800;height:600');
			return;
		}			
			
	}
	
</script> 

</head>
<body>

   <div class="pageTitle">Programme Maintenance - Edit </div>
   <div class="wTab">
     <table height="100%" cellspacing="0" cellpadding="0" border="0" id="programmeTabs">
       <tbody><tr>
         <td id="itemA" class="item1">
         	<a href="programme-info.action?programmeId=<s:property value='programmeId'/>">Programme Information</a>
         </td>
         <td id="itemB" class="item1">
         	<a href="programme-accreditation.action?programmeId=<s:property value='programmeId'/>">Programme Accreditation</a>
         </td>
         <td id="itemC" class="item2">
         	<a href="programme-subject-group.action?programmeId=<s:property value='programmeId'/>">Subject Group</a>
         </td>
       </tr>
      </tbody>
     </table>
   </div>
	
	    <div class="form2" id="programmeSubjectGroupDiv">
	    
			<s:form id="mainForm" name="mainForm" action="programme-subject-group!list.action" method="post">
			  
			  <s:hidden name="programmeId"></s:hidden>
			  <s:hidden name="code"></s:hidden>
  	    
              <div class="pageTitle2">Level 1 Programme</div>
              <table cellspacing="0" cellpadding="0" border="0">
                <tbody><tr>
                  <td class="sep"><img style="width:250px;" src="../images/spacer.gif"></td>
                  <td class="sep sep2"><img src="../images/spacer.gif"></td>
                </tr>
                <tr>
                  <td><label class="fLabel">Programme Code </label>
                    <div class="fField">
                      <input type="text" disabled="disabled" value="<s:property value='code'/>" name="" id="" class="inputText">
                    </div></td>
                </tr>
              </tbody></table>
              <br>
              <div class="pageTitle2">Level 2 Programmes</div>
              <div class="sListBorder"> 
              <div class="sList">
                    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="sTable">
                       <tbody>
                       <tr>
                          <td class="sTh checkbox"><input type="checkbox" name="" id="" class="inputCheckbox"></td>
                          <td style="width:180px" class="sTh">Planning Exercise </td>
	                      <td class="sTh">Programme Code</td>
	                      <td style="width:80px" class="sTh">Action</td>
                       </tr>
                       
			      <s:iterator value="subjectGroups" var="subjectGroup" status="st">
			       
			      	  <s:set var="trClass" value="'sRow1'"></s:set>
			    	  <s:if test="#st.index%2==0">
			       	 	 <s:set var="trClass" value="'sRow2'"></s:set>
					  </s:if>
				      <s:else>
			       	     <s:set var="trClass" value="'sRow1'"></s:set>
			       	  </s:else>
					  
				      <tr class="<s:property value='#trClass'/>">                       
                      	<td class="sCell"><input type="checkbox" name="groupIds" value="<s:property value='#subjectGroup.id'/>" class="inputCheckbox"></td>
                      	<td class="sCell"><s:property value='#subjectGroup.planningExercise'/>/<s:property value="#subjectGroup.planningExerciseEndYear.toString().substring(2,4)"/> </td>
                      	<td class="sCell">
                      		<ol class="normalOL">
                      		  
                      		  <s:iterator value="#subjectGroup.subjectGroupItems" var="subjectGroupItem" status="stItem">
	                          	
	                          	<li><s:property value='#subjectGroupItem.programmeCode.code'/></li>
	                          
	                          </s:iterator>
	                          	
                       	 	</ol>
                       	</td>
                        <td class="sCell"><div class="button sbtn">
                          <div class="left">
                            <div class="right">
                              <input type="button" onclick="clickBtn('edit',event,'<s:property value='#subjectGroup.id'/>')" value="<s:text name='common.btn.edit'/>" name="" id="" class="inputButton">
                            </div>
                          </div>
                         </div>
                        </td>
                    </tr>
                  </s:iterator>  
                  
                  </tbody></table>
                </div>
                <div class="btnSet btnSetTypeA">
                  <div class="left">
                    <div class="button">
                      <div class="left">
                        <div class="right">
                          <input type="button" onclick="clickBtn('add',event)" value="Add" name="" id="addGroupBtn" class="inputButton">
                        </div>
                      </div>
                    </div>
                    <div class="button">
                      <div class="left">
                        <div class="right">
                          <input type="button" onclick="clickBtn('delete',event)" value="<s:text name='common.btn.delete'/>" name="" id="deleteGroupBtn" class="inputButton">
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <br>
              
         </s:form>
      </div>
</body>
</html>   